package com.lj.back.manage.scaffold.module.sys.DTO;

import com.lj.back.manage.scaffold.common.annotation.valid.Phone;
import com.lj.back.manage.scaffold.common.valid.group.AddStrategy;
import com.lj.back.manage.scaffold.common.valid.group.UpdateStrategy;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Set;

/**
 * @author lv
 * @version 1.0.0
 */
@Data
@ApiModel("后台用户传输对象")
public class SysUserDTO implements Serializable {
    /**
     * 用户ID
     */
    @NotNull(message = "{user.id.notnull}",groups = UpdateStrategy.class)
    @Null(message = "{user.id.isnull}",groups = AddStrategy.class)
    @ApiModelProperty(value = "用户ID", example = "1")
    private Long id;

    /**
     * 用户名称
     */
    @NotBlank(message = "{user.name.notnull}",groups = AddStrategy.class)
    @Null(message = "{user.name.isnull}",groups = UpdateStrategy.class)
    @ApiModelProperty(value = "用户名", example = "zhangsan")
    private String name;

    /**
     * 用户密码
     */
    @NotBlank(message = "{user.password.notnull}",groups = AddStrategy.class)
    @Null(message = "{user.password.isnull}",groups = UpdateStrategy.class)
    @ApiModelProperty(value = "密码,MD5加密传输", example = "e10adc3949ba59abbe56e057f20f883e")
    private String password;

    /**
     * 邮箱
     */
    @Email(message = "{email.pattern}")
    @ApiModelProperty(value = "邮箱", example = "1234567@163.com")
    private String email;

    /**
     * 手机号码
     */
    @Phone
    @ApiModelProperty(value = "手机号", example = "13912345678")
    private String mobile;

    /**
     * 状态：1正常  2锁定
     */
    @Null(message = "{sys.user.status.null}",groups = AddStrategy.class)
    @ApiModelProperty(value = "用户状态 1正常  2锁定", example = "1")
    private String status;

    /**
     * 角色Id集合
     */
    @ApiModelProperty(value = "角色ID集合", example = "[1, 2, 3]")
    private Set<Long> roleIds;

    /**
     * 创建时间
     */
    @ApiModelProperty(hidden = true)
    @Null(message = "{createTime.isnull}")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "真实姓名", example = "张三")
    @NotNull(message = "{user.realName.notnull}", groups = AddStrategy.class)
    @Null(message = "{user.realName.null}", groups = UpdateStrategy.class)
    private String realName;

    private static final long serialVersionUID = 1L;
}
